/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package apartmentBean;

import bo.ClientBus;
import domain.pojo.Client;
import java.io.Serializable;
import java.sql.Date;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author lion
 */
@ManagedBean
@ViewScoped
public class ClientBean implements Serializable{

    /**
     * Creates a new instance of ClientBean
     */
    private Client client;
    private ClientBus clientBus;

    public ClientBean() {
        client = new Client();
        clientBus = new ClientBus();
    }
    
    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }

    public ClientBus getClientBus() {
        return clientBus;
    }

    public void setClientBus(ClientBus clientBus) {
        this.clientBus = clientBus;
    }
    
    public Integer addClient()
    {
        Date date = new Date(System.currentTimeMillis());
        client.setCreator("duongpb");
        client.setCreated(date);
        return clientBus.getClientDaoImpl().insertClient(client);
    }
}
